package com.fin.zw.aiqas.entity;

import com.fin.zw.aiqas.enums.AllotRule;
import com.fin.zw.aiqas.enums.ReviewTaskStatus;
import lombok.Data;
import org.hibernate.annotations.Table;

import javax.persistence.*;
import java.math.BigDecimal;
import java.util.Set;


/**
 * @Description: 复核任务主表
 * @Author: ZhangGQ
 * @Date: 2019/9/11 15:14
 */

@Entity
@Table(appliesTo = "review_task",comment = "复核任务表")
@Data
public class ReviewTask extends BaseEntity{

    @Column(columnDefinition = "varchar(64) COMMENT '复核任务批次'")
    private String reviewTaskBatch;
    @Column(columnDefinition = "int(7) COMMENT '复核任务数量'")
    private int reviewTaskNum;
    @Column(columnDefinition = "int(7) COMMENT '复核任务完成数量'")
    private int reviewTaskFinishNum;
    @Column(columnDefinition = "int(4) COMMENT '复核任务分配人数'")
    private int reviewUserNum;
    @Column(columnDefinition = "varchar(64) COMMENT '复核任务状态'")
    @Enumerated(EnumType.STRING)
    private ReviewTaskStatus reviewTaskStatus;
    @Column(columnDefinition = "decimal(18,4) COMMENT '抽检比例'")
    private BigDecimal checkProp;
    @Column(columnDefinition = "bigint(64) COMMENT '定时任务id'")
    private Long taskId;
    @Column(columnDefinition = "varchar(64) COMMENT '定时任务质检结果批次号'")
    private String taskBatch;
    @Column(columnDefinition = "varchar(64) COMMENT '客服编号'")
    private String serviceCode;
    @Column(columnDefinition = "varchar(64) COMMENT '分配规则-[SYNTHESIZE：综合均分 / ALLOT_AVG：平均分配]'")
    @Enumerated(EnumType.STRING)
    private AllotRule allotRule;

    @ManyToMany(fetch = FetchType.EAGER)
    @JoinTable(name = "review_task_user", joinColumns = @JoinColumn(name = "review_task_id"), inverseJoinColumns = @JoinColumn(name = "user_id"))
    private Set<UserInfo> userInfoSet;

}
